#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
char str[25][15];
int cmp(char s1[], char s2[])
{
	int len1 = strlen(s1);
	int len2 = strlen(s2);	
	int i1 = 0;
	int i2 = 0;
	while(i1 != len1 && i2 != len2)
	{
		if(s1[i1] > s2[i2]) return 1;
		else if(s1[i1] < s2[i2]) return 0;
		i1++;
		i2++;
	}
	if(s1[len1 - 1] > s2[len2-1]) return 1;
	else return 0;
}
int main()
{
	freopen("in.txt","r",stdin);
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> str[i];
	}
	for(int i = 2; i <= n; i++)
	{
		int j;
		if(cmp(str[i],str[i-1]))
		{
			strcpy(str[0],str[i]);
			for(j = i-1; cmp(str[0],str[j]);j--)
			{
				strcpy(str[j+1],str[j]);
			}
			strcpy(str[j+1],str[0]);
		}
	}
	for(int i = 1; i <= n; i++)
	{
		cout << str[i];
	}
}
